import random
money = 5000
num = random.randint(1, 100)
cai = int(input('输入猜测的数字:'))
while cai != num:
    if cai > num and money > 0:
        money = money - 500
        print(money)
        print('大了')
    else:
        money = money - 500
        if money == 0:
           print('游戏退出')
           break
        print(money)
        print('小了')
    cai = int(input('再猜一次:'))
    if cai == num:
        money = money + 3000
        print(money)
        print('猜对了,nb')
        print('游戏结束')
        cai = int(input('新一轮游戏开始了,请输入:'))

